layui.use('form', function() {
    var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功

    form.on('select', function (data) {
        resState =(data.value);



        //alert("onchange进来了")

        if(resState=="推荐二面"){
            //alert("推荐二面进来了")
            let myDate = new Date();
            $("#firstMianPeople").val(uus);
            //获取当前日期
            //alert(myDate.toLocaleDateString())
            //赋值给时间
            $("#firstMianTime").val(myDate.toLocaleDateString());
            //同时将一面面试评价的只读取消
            $("#firstMianAppraise").attr("readOnly",false);

        }

        if(resState=="推荐三面"){
            //alert("推荐三面进来了")
            let myDate = new Date();

            $("#secondMianPeople").val(uus);
            //获取当前日期

            //赋值给时间
            $("#secondMianTime").val(myDate.toLocaleDateString());
            //同时将一面面试评价的只读取消
            $("#secondMianAppraise").attr("readOnly",false);

        }

        if(resState=="建议录用"){
            //alert("建议录用进来了")
            //获取当前日期
            let myDate = new Date();

            $("#thirdMianPeople").val(uus);

            //赋值给时间
            $("#thirdMianTime").val(myDate.toLocaleDateString());
            //同时将一面面试评价的只读取消
            $("#thirdMianAppraise").attr("readOnly",false);

        }
        form.render();
    });

});

function fanhui() {
    window.location.href="/面试管理"
}

function jiazai() {
    let t = $("#tt1").find("div").find("div").find("div").find("div").find("input").val()

    let t1 = $("#tt1").find("div").find("div").find("div").find("dl").find("dd").eq(0);
    let t2 = $("#tt1").find("div").find("div").find("div").find("dl").find("dd").eq(1);
    let t3 = $("#tt1").find("div").find("div").find("div").find("dl").find("dd").eq(2);
    let t4 = $("#tt1").find("div").find("div").find("div").find("dl").find("dd").eq(3);
    let t5 = $("#tt1").find("div").find("div").find("div").find("dl").find("dd").eq(4);
    if (t=="推荐面试"){
        t3.attr("class","layui-this");
    }
    if (t=="推荐二面"){
        t4.attr("class","layui-this");
    }
    if (t=="推荐三面"){
        t5.attr("class","layui-this");
    }
}

function save1(interviewId) {
    let status = $("#tt1").find("div").find("div").find("div").find("div").find("input").val();
    let oneInterviewer = $("#firstMianPeople").val().trim();
    let oneTime =$("#firstMianTime").val().trim();
    let oneOpinion=$("#firstMianAppraise").val().trim();
    let twoInterviewer=$("#secondMianPeople").val().trim();
    let twoTime=$("#secondMianTime").val().trim();
    let twoOpinion=$("#secondMianAppraise").val().trim();
    let threeInterviewer=$("#thirdMianPeople").val().trim();
    let threeTime=$("#thirdMianTime").val().trim();
    let threeOpinion=$("#thirdMianAppraise").val().trim();


    let jsonA={
        interviewId:interviewId,
        status:status,
        oneInterviewer:oneInterviewer,
        oneTime:oneTime,
        oneOpinion:oneOpinion,
        twoInterviewer:twoInterviewer,
        twoTime:twoTime,
        twoOpinion:twoOpinion,
        threeInterviewer:threeInterviewer,
        threeTime:threeTime,
        threeOpinion:threeOpinion
    }

    $.ajaxSettings.async=false;
    $.getJSON("/save1",jsonA,function (data) {
        if (data > 0){
            alert("保存成功！")
            window.location.href = "/面试管理"
        }else {
            alert("保存失败！")
        }

    })
    $.ajaxSettings.async=true;
}